package edu.gatech.cs2340.group7.wheresmystuffapp.presenters;

import android.content.Intent;
import edu.gatech.cs2340.group7.wheresmystuffapp.model.Account;
import edu.gatech.cs2340.group7.wheresmystuffapp.model.DataManager;
import edu.gatech.cs2340.group7.wheresmystuffapp.views.ShowSearchView;

public class SearchPagePresenter {

	private ShowSearchView view;

	public SearchPagePresenter(ShowSearchView v) {
		this.view = v;
	}

	/**
	 * Takes the user to the search results page
	 * @param intent the intent that will take them there
	 */
	public void showSearchResults(Intent intent) {
		view.startActivity(intent);
	}

	/**
	 * Logs the user out
	 * @param intent
	 */
	public void logout(Intent intent) {
		Account a = DataManager.getCurrentAccount();
		a.setLoginAttempts(0);
		DataManager.setCurrentAccount(null);
		view.startActivity(intent);
	}

	/**
	 * Takes the user back to the main menu
	 * @param intent
	 */
	public void backToMainMenu(Intent intent) {
		view.startActivity(intent);
	}

}
